package com.chixing.day03_oop;

public class Person {
    private String personName;
    private int personAge;
    private String personGender;    //char personGender  M 男 F女
    private String personMarry;

    public Person(String name,int age,String gender,String marry){
        this.personName = name;
        this.personAge = age;
        this.personGender = gender;
        this.personMarry = marry;
    }

    public boolean canMarry(Person anotherPerson){
        if (this.personGender == anotherPerson.personGender)
            return false;
        if (this.personMarry =="已婚" || anotherPerson.personMarry =="已婚")
            return false;
        if (!(this.personGender == "男" && this.personAge >= 24 && anotherPerson.personAge >= 22 ||
            this.personGender == "女" && this.personAge >= 22 && anotherPerson.personAge >= 24))
            return false;
        return true;
    }

    public String getPersonName() {
        return personName;
    }

    public void setPersonName(String personName) {
        this.personName = personName;
    }

    public int getPersonAge() {
        return personAge;
    }

    public void setPersonAge(int personAge) {
        this.personAge = personAge;
    }

    public String getPersonGender() {
        return personGender;
    }

    public void setPersonGender(String personGender) {
        this.personGender = personGender;
    }

    public String getPersonMarry() {
        return personMarry;
    }

    public void setPersonMarry(String personMarry) {
        this.personMarry = personMarry;
    }

}
